package single;

/*
Author     :Dsi
Date       : 2021/11/25 19:50
Description: 单例模式的饿汉以及懒汉
*/
public class Demo01 {
}
class Stu{
    private static Stu s=new Stu();
    private Stu(){}
    public static Stu getS(){
        return s;
    }
}

class Per{
    private static Per p;
    private Per(){}
    public static Per getp(){
//        if (p == null) {
//            p=new Per();
//        }
        p=new Per();
        return p;
    }
}